package com.ymatou.iapi.productprice.service;

import com.ymatou.iapi.productprice.parameter.GetPriceByProdIdBean;
import com.ymt.base.YmatouBaseCall;
import com.ymttest.utils.EnvSetup;
import com.google.gson.JsonObject;
import org.json.JSONObject;

import java.io.IOException;

public class GetPriceByProdIdCall extends YmatouBaseCall implements PriceInterface{

	private static String opurl ="api/Price/GetPriceByProdId";
	
	public GetPriceByProdIdCall() {
		super(EnvSetup.getSystemUrl("productprice"),opurl,"GET","PARAM");
	}
	@Override
	public void addDefHeader() {
		client.addHeader("Accept","text/xml,text/javascript,text/html,application/json");
		client.addHeader("Content-Type", "application/json; charset=UTF-8");
	}

	public JsonObject callAndGetReturnData(int buyerId, String productId) throws IOException {
		GetPriceByProdIdBean getPriceByProdIdBean = new GetPriceByProdIdBean();
		getPriceByProdIdBean.setProductId(productId);
		getPriceByProdIdBean.setBuyerId(buyerId);
		setData(getPriceByProdIdBean);
		this.callService();
		return this.getJsonObject();
	}

	public JsonObject callAndGetReturnData() throws IOException {
		callService();
		return this.getJsonObject();
	}

	@Override
	public JSONObject GetReturnDataByBuyerAndId(int buyerId, String productIdOrCatalogId) {
		return null;
	}


//	public com.google.gson.JsonObject callAndReturnData(int buyer,String productId){
//		GetPriceByProdIdCall getPriceByProdIdCall = new GetPriceByProdIdCall();
//		GetPriceByProdIdBean getPriceByProdIdBean = new GetPriceByProdIdBean();
//		getPriceByProdIdBean.setBuyerId(buyer);
//		getPriceByProdIdBean.setProductId(productId);
////		getPriceByProdIdCall.set;
////		return callAndReturnData();
//	}

//	@Override
//	public JSONObject GetReturnDataByBuyerAndId(int buyerId, String id) {
//		return callAndGetReturnData(buyerId,id);
//	}

}
